1.0 Objectives This document will explain how to build, port and run Android operating system on Iphone.
2.0 Requirements and System Information
Host PC: A Linux computer which is strong enough to build Android from source, If Android Gingerbread and newer version will be built, 64 bit operating system is required
Development computer that used for this project
Fedora release 12 (Constantine)
Kernel Linux 2.6.31.5-127.fc12.i686.PAE
Memory 2 GB
Processor: Intel Dual CPU T3400
Target device: Device that we are going to run Android on it. Currently Iphone 2g or Iphone 3g support boatload changes.
Device that used for this project
Iphone 2G (first generation)
Software:
OpenIboot Bootloader
3.0 Preparing Device(Iphone) for Porting Boot loader change is required to install and run Android OS in Iphone device. OpenIboot bootloader give us change to run Android OS in Iphone (http://www.idroidproject.org/wiki/OpeniBoot) Currently Openiboot only supports:
Iphone fist generation (2g)
Iphone second generation (3g)
SSH Connection: In order to change boot loader and download Android OS we need SSH connection to Iphone.
4.0 To Check Out and Build Android Source code Android is open-source software. Android source web page is (http://source.android.com). Android project officially supports Ubuntu LTS (10.04). According to Android web, to build Android source files Linux or Mac OS is enough. We'll built android under Fedora 12 (please look at host PC spec for more information) Please check http://source.android.com for Android source code building official guide. This guide that you are reading now will cover to check out Android source, to get building information for Iphone and building Android under Fedora 12.
4.1 Host PC Setup
I login as root to host computer (I know it's not a good idea). Fedora doesn't let root login after Fedora 11th release but there are some trick to get permission. If you login to host PC as a regular user, you may get some permission error which I haven’t got. If you get permission error please get root level access and try your command again.
$ yum install libX11-devel ncurses-devel readline-devel openssh-clients wget bison flex gperf gcc-c++ jpackage-utils git make zip zlib-devel
Building Gingerbread(2.3) and newer version required Java 6. Building Froyo(2.2) and older version required Java 5
Note: I tried to build Gingerbread at fist but since my OS is 32 bit make gave an error. I had to lower the version and download Froyo
For Froyo, we need to install Java5 Installing JAVA In my case
$ yum install sun-java5-jdk
It didn’t work.
$ yum install sun-java5-jdk Loaded plugins: presto, refresh-packagekit updates/metalink | 2.6 kB 00:00 Setting up Install Process No package sun-java5-jdk available. Nothing to do
I had to install JAVA 5 via building RPM packet by using the Java nosrc SRPM from http://www.jpackage.org/
Download the J2SE (JDK) package from Sun: (http://java.sun.com/products/archive/j2se/5.0_22/index.html) Linux self-extracting file is required for building, not the rpm. “jdk-1_5_0_22-linux-i586.bin“ works fine. Move this file into the rpm/SOURCES directory:
Create folder to keep Android source. We can give any name.
$ mkdir ~/myandroid $ cd ~/myandroid
We need to get the manifest, which defines where the Android source repository, by running “repo init” - b version can be used for getting different version of Android. More information about repo:(http://source.android.com/source/version-control.html). We are not going to use Android official repository to get manifest. Even though we’ll get Android source from Android official repository, we need use other repository to get Iphone hardware definition and some modules
When prompted, need to configure Repo with name and email address. After downloaded the manifest, open manifest “default.xml’// in text editor
$ vi ~/myandroid/root/idroid/.repo/manifests/default.xml
if we look at the top section of manifest there is two repository is defined We need to change <default revision="froyo" remote="Korg" /> to <default revision="froyo" remote="Google" /> to get android source from Google if we look at manifest there is only so many components need to be downloaded from different location
run make (-j = num of compile processes, 2 per core, j2 for single core, j4 for dual-core, j8 for quad-core)
$ make -j2
Compilation time takes long time. In my pc it takes approximately 35 minutes. when compiling Android finish successfully location of my binaries is : ~/myandroid/out/target/product/ipone2/
6.0 Building Linux Kernel Android NDK is required. The Android NDK is a toolset that give us components that make use of native code in Android applications. The NDK allows native-code languages such as C and C++ run in the Android. Also NDK has gcc toolset that we can use to compile the kernel.
Download and extract the Android NDK from official website if it is not already in the development computer. (http://developer.android.com/sdk/ndk/index.html). Untar Android NDK in a folder
$ tar xvjf android-ndk-r7-linux-x86.tar.bz2
Create a folder where kernel source will be copied and clone kernel repo
What we have here is modified version of Linux kernel 2.6.39 , which can run in Iphone
$ cd kernel_common $ ls –l
Building kernel procedure is same. First change the configuration.
$ make menuconfig
or
$ make xconfig
or
$ make gconfig
Change the device building to Iphone System type > Arm system type> select Apple Iphone System type Apple Iphone platform type > Select device {Iphone 2G} Save and exit.
Before building the kernel let’s put some debug message in kernel boot process so we can see if our kernel is running in the device.
Find ”static noinline int init_post(void)” function after ”numa_default_policy();” line, add couple lines of printk() .(more printk() makes it easy to be seen on small Iphone screen)
printk("* MY kernel 1! *\n"); printk("* YOUR kernel 1! *\n"); printk("* I kernel ! *\n"); printk("* MY kernel 1! *\n"); printk("* YOUR kernel 1! *\n"); printk("* I kernel ! *\n");
We’ll use the NDK tool chain to built kernel <android-ndk-location>/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-
To define which tool chain will be used to kernel build, CROSS_COMPILE is needed to be set. Add location to $PATH and set CROSS_COMPILE with relative path
8.0 Porting Android to Iphone Kernel and Android OS are built, now we need to transfer these files to device(Iphone) and run it. To transfer files to Iphone sftp connection is required (look at: section 3.0 Preparing Device(Iphone) for Porting) transfer all files to Iphone /var directtory
system.img
Created during Android build
ramdisk.img
Created during Android build
userdata.img
Created during Android build
zImage
Kernel image that were created during kernel built
android.img.gz
It is Android initrd (initial ramdisk). It can be created by “create-initrd-android.sh” Bul all required firmware is necessary. I used the prebuilt one in this project.
9.0 Trobleshooting Problems that I have had engaged during this project and their solutions. Most of them are related to Android OS and Linux kernel building procedure
9.1 Kernel Building Issues
$make –j2 ... CC kernel/cpuset.o kernel/cpuset.c: In function 'cpuset_can_attach': kernel/cpuset.c:1333: error: 'task' undeclared (first use in this function) kernel/cpuset.c:1333: error: (Each undeclared identifier is reported only once kernel/cpuset.c:1333: error: for each function it appears in.) make[1]: * [kernel/cpuset.o] Error 1 make: * [kernel] Error 2
Solution:
$ make menuconfig
Genereal Setup>Control Group support>Cpuset Support à Disable
$make –j2 ...
CC drivers/video/console/vgacon.o drivers/video/console/vgacon.c: In function 'vgacon_startup': drivers/video/console/vgacon.c:508: error: 'PCIMEM_BASE' undeclared (first use in this function) drivers/video/console/vgacon.c:508: error: (Each undeclared identifier is reported only once drivers/video/console/vgacon.c:508: error: for each function it appears in.) drivers/video/console/vgacon.c: In function 'vgacon_do_font_op': drivers/video/console/vgacon.c:1068: error: 'PCIMEM_BASE' undeclared (first use in this function) make[3]: * [drivers/video/console/vgacon.o] Error 1 make[2]: * [drivers/video/console] Error 2 make[1]: * [drivers/video] Error 2 make: * [drivers] Error 2
Solution:
$ make menuconfig
Device Drivers>Graphics support>Console display driver support>VGA text Console àDisable
$make –j2 ...
drivers/video/iphone-fb.c: In function 'iphonefb_suspend': drivers/video/iphone-fb.c:385: error: implicit declaration of function 'platform_device_get_drvdata' edit drivers/video/iphone-fb.c: add #include <linux/device.h>
Solution:
$ make menuconfig
Power management > warelock à Early Suspend
CHECK include/linux (354 files) /root/Downloads/kernel_common/usr/include/linux/if_pppox.h:24: included file 'linux/if_pppolac.h' is not exported /root/Downloads/kernel_common/usr/include/linux/if_pppox.h:25: included file 'linux/if_pppopns.h' is not exported
Solution: Disable kernel header check.
$ make menuconfig
Kernel hacking ->Run 'make headers_check' when building vmlinux à disable
arch/arm/mach-apple_iphone/built-in.o: In function `iphone_i2c_init': suspend.c:(.init.text+0x694): undefined reference to `i2c_add_numbered_adapter' suspend.c:(.init.text+0x6b0): undefined reference to `i2c_add_numbered_adapter' make: *** [.tmp_vmlinux1] Error 1
Solution: Disable kernel header check.
$ make menuconfig
Device drivers > I2C support à enabled
9.2 Android Issues
I’d like to build Gingerbread at first but when I tried to build I received the error below
Checking build tools versions... build/core/main.mk:76: build/core/main.mk:77: You are attempting to build on a 32-bit system. build/core/main.mk:78: Only 64-bit build environments are supported beyond froyo/2.2. build/core/main.mk:79: build/core/main.mk:80: *** stop. Stop.
Solution: git needs to be updated to 1.6.6 or newer.
$yum update git
$Make –j2
Checking build tools versions... You are attempting to build with the incorrect version of java. Your version is: java version "1.6.0_0". The correct version is: 1.5.
In my system (fedora 12) default java version is 1.6. I couldn’t build Gingerbread because it requires 64 bit OS. I moved to Froyo and it requires java version 1.5 Solution: downgrade java to version 1.5
$ [root@localhost ~]# java -version java version "1.5.0_22" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_22-b03) Java HotSpot(TM) Server VM (build 1.5.0_22-b03, mixed mode)
make: *** Waiting for unfinished jobs.... sh: gperf: command not found calling gperf failed: 32512 at ./makeprop.pl line 96.
Solution: install gperf tool
$yum install gperf
$ repo init -u git://github.com/iDroid-Project/platform_manifest.git -b gingerbread fatal: Unable to look up github.com (port 9418) (Temporary failure in name resolution)
Problem was network. I was trying to download in my office but office firewall didn’t let me download.
Downloading Idroid problems
$repo init -u git:github.com/iDroid-Project/platform_manifest.git -b gingerbread warning: no common commits remote: Counting objects: 470, done. remote: Compressing objects: 100% (206/206), done. remote: Total 470 (delta 182), reused 433 (delta 149) Receiving objects: 100% (470/470), 98.98 KiB, done. Resolving deltas: 100% (182/182), done. From git:github.com/iDroid-Project/platform_manifest * [new branch] froyo-iphone -> origin/froyo-iphone + 1b6c432...8c13d26 gingerbread -> origin/gingerbread (forced update) + 1e41b43...1e65323 master -> origin/master (forced update) From git:github.com/iDroid-Project/platform_manifest * [new tag] android-1.0 -> android-1.0 .repo/manifests/: manifest switched android-2.2.2_r1...gingerbread .repo/manifests/: discarding 19 commits removed from upstream fatal: manifest 'default.xml' not available fatal: remote korg not defined in /root/.repo/manifests/default.xml//
First I didn’t understand the problem. Removed target folder and recheck out
$repo init -u git:github.com/iDroid-Project/platform_manifest.git -b gingerbread fatal: manifest 'default.xml' not available fatal: remote korg not defined in /root/.repo/manifests/default.xml
Problem was clear. Definition was missing in Android manifesto. Checked /root/.repo/manifests/default.xml
[root@localhost ~]# make -j2 ============================================ PLATFORM_VERSION_CODENAME=REL PLATFORM_VERSION=2.3.7 TARGET_PRODUCT=iPhone2G TARGET_BUILD_VARIANT=eng TARGET_SIMULATOR=false TARGET_BUILD_TYPE=release TARGET_BUILD_APPS= TARGET_ARCH=arm TARGET_ARCH_VARIANT=armv7-a HOST_ARCH=x86 HOST_OS=linux HOST_BUILD_TYPE=release BUILD_ID=GINGERBREAD ============================================ build/core/base_rules.mk:78: * Module name: test_guard_variables build/core/base_rules.mk:79: * Makefile location: android-ndk-r7/tests/device/test-gabi++-guard/jni build/core/base_rules.mk:80: * build/core/base_rules.mk:81: * Each module must use a LOCAL_MODULE_TAGS in its build/core/base_rules.mk:82: * Android.mk. Possible tags declared by a module: build/core/base_rules.mk:83: * build/core/base_rules.mk:84: * optional, debug, eng, tests, samples build/core/base_rules.mk:85: * build/core/base_rules.mk:86: * If the module is expected to be in all builds build/core/base_rules.mk:87: * of a product, then it should use the build/core/base_rules.mk:88: * "optional" tag: build/core/base_rules.mk:89: * build/core/base_rules.mk:90: * Add "LOCAL_MODULE_TAGS := optional" in the build/core/base_rules.mk:91: * Android.mk for the affected module, and add build/core/base_rules.mk:92: * the LOCAL_MODULE value for that component build/core/base_rules.mk:93: * into the PRODUCT_PACKAGES section of product build/core/base_rules.mk:94: * makefile(s) where it's necessary, if build/core/base_rules.mk:95: * appropriate. build/core/base_rules.mk:96: * build/core/base_rules.mk:97: * If the component should be in EVERY build of ALL build/core/base_rules.mk:98: * products, then add its LOCAL_MODULE value to the build/core/base_rules.mk:99: * PRODUCT_PACKAGES section of build/core/base_rules.mk:100: * build/target/product/core.mk build/core/base_rules.mk:101: * build/core/base_rules.mk:102: * user tag detected on new module - user tags are only supported on legacy modules. Stop. [root@localhost ~]#
This document will explain how to build, port and run Android operating system on Iphone.
2.0 Requirements and System Information
3.0 Preparing Device(Iphone) for Porting
Boot loader change is required to install and run Android OS in Iphone device. OpenIboot bootloader give us change to run Android OS in Iphone (http://www.idroidproject.org/wiki/OpeniBoot)
Currently Openiboot only supports:
- Iphone fist generation (2g)
- Iphone second generation (3g)
SSH Connection: In order to change boot loader and download Android OS we need SSH connection to Iphone.3.2 SFTP File Transfer
4.0 To Check Out and Build Android Source code
Android is open-source software. Android source web page is (http://source.android.com). Android project officially supports Ubuntu LTS (10.04). According to Android web, to build Android source files Linux or Mac OS is enough. We'll built android under Fedora 12 (please look at host PC spec for more information) Please check http://source.android.com for Android source code building official guide. This guide that you are reading now will cover to check out Android source, to get building information for Iphone and building Android under Fedora 12.
4.1 Host PC Setup
I login as root to host computer (I know it's not a good idea). Fedora doesn't let root login after Fedora 11th release but there are some trick to get permission. If you login to host PC as a regular user, you may get some permission error which I haven’t got. If you get permission error please get root level access and try your command again.For root login access to fedora (http://linuxers.org/quick-tips/fedora-12-enable-root-login-gui)
First let’s install some required and useful packages for building the Android source.
Building Gingerbread(2.3) and newer version required Java 6.
Building Froyo(2.2) and older version required Java 5
Note: I tried to build Gingerbread at fist but since my OS is 32 bit make gave an error. I had to lower the version and download Froyo
For Froyo, we need to install Java5
Installing JAVA
In my case
It didn’t work.
Loaded plugins: presto, refresh-packagekit
updates/metalink | 2.6 kB 00:00
Setting up Install Process
No package sun-java5-jdk available.
Nothing to do
I had to install JAVA 5 via building RPM packet by using the Java nosrc SRPM from http://www.jpackage.org/
$ cd {HOME}/rpm/RPMS
$ wget http://mirrors.dotsrc.org/jpackage/5.0/generic/non-free/SRPMS/java-1.5.0-sun-1.5.0.15-1jpp.nosrc.rpm
$ rpm -ihv java-1.5.0-sun-1.5.0.15-1jpp.nosrc.rpm
Download the J2SE (JDK) package from Sun: (http://java.sun.com/products/archive/j2se/5.0_22/index.html)
Linux self-extracting file is required for building, not the rpm.
“jdk-1_5_0_22-linux-i586.bin“ works fine.
Move this file into the rpm/SOURCES directory:
Update the SPEC file for our version of Java 5 JDK version (Which is 22)
$ vi java-1.5.0-sun.spec
Chang the line that “%define buildver 15” to “%define buildver 22”
Save and exit the “vi”
To build the package:
rpmbuild -ba java-1.5.0-sun.spec
Building java p5 package is done, now we need to install in to our PC
The packages in here are can be installed on the system using the rpm command.
We need to install java-1.5.0-sun and java-1.5.0-sun-devel packages.
Tutorial:(http://iomem.com/archives/1-Building-Java-RPMS-for-Redhat-Enterprise-Linux.html)
After installation is done check for the which java is in use
The correct version is: 1.5. If it is not the correct version, we cannot build android
To change java in the system :locate where javac is
$ locate javac |grep bin
Identify JDK 1.5 location and add it’s path at he beginning of the PATH
Host PC should be ready now to built the Android
5.0 Building Android OS
5.1 Downloading Android source
Google give us frond-end tool which called “Repo”, to work with Android repository easilyCreate bin folder in home directory and add it to PATH
$ PATH=~/bin:$PATH
Download Repo and make it executable (I used wget instate of curl to download repo)
$ wget http://android.git.kernel.org/repo
$ chmod a+x repo
Create folder to keep Android source. We can give any name.
$ cd ~/myandroid
We need to get the manifest, which defines where the Android source repository, by running “repo init” - b version can be used for getting different version of Android.
More information about repo:(http://source.android.com/source/version-control.html).
We are not going to use Android official repository to get manifest. Even though we’ll get Android source from Android official repository, we need use other repository to get Iphone hardware definition and some modules
We need Android Froyo so
When prompted, need to configure Repo with name and email address.
After downloaded the manifest, open manifest “default.xml’// in text editor
We need to change <default revision="froyo" remote="Korg" /> to <default revision="froyo" remote="Google" /> to get android source from Google
if we look at manifest there is only so many components need to be downloaded from different location
<project path="external/busybox" name="platform_external_busybox" remote="iDroid" />
<project path="external/alsa-utils" name="platform_external_alsa-utils" remote="iDroid" />
The most imported one is busybox
<remote name="Google"
fetch="https://android.googlesource.com/"
review="review.source.android.com" />
<remote name="iDroid" fetch="git:github.com/iDroid-Project/" />
<default revision="gingerbread" remote="Google" />
<project path="build" name="platform_build" remote="iDroid">
<copyfile src="core/root.mk" dest="Makefile" />
</project>//
If manifest is fine we can download the source
It'll take some time to download about 2GB source code
5.1 Compiling the Android Source
When downloading is done
(I selected the iphone2)
PLATFORM_VERSION=2.3.7
TARGET_PRODUCT=iPhone2G
TARGET_BUILD_VARIANT=eng
TARGET_SIMULATOR=false
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=FROYO
run make (-j = num of compile processes, 2 per core, j2 for single core, j4 for dual-core, j8 for quad-core)
Compilation time takes long time. In my pc it takes approximately 35 minutes. when compiling Android finish successfully location of my binaries is : ~/myandroid/out/target/product/ipone2/
6.0 Building Linux Kernel
Android NDK is required. The Android NDK is a toolset that give us components that make use of native code in Android applications. The NDK allows native-code languages such as C and C++ run in the Android. Also NDK has gcc toolset that we can use to compile the kernel.
Download and extract the Android NDK from official website if it is not already in the development computer. (http://developer.android.com/sdk/ndk/index.html). Untar Android NDK in a folder
Create a folder where kernel source will be copied and clone kernel repo
$cd ~/<kernel_location>
$ git clone http://github.com/iDroid-Project/kernel_common.git
Cloning into kernel_common...
remote: Counting objects: 1374805, done.
remote: Compressing objects: 100% (243965/243965), done.
remote: Total 1374805 (delta 1143361), reused 1345333 (delta 1121344)
Receiving objects: 100% (1374805/1374805), 355.62 MiB | 543 KiB/s, done.
Resolving deltas: 100% (1143361/1143361), done.
What we have here is modified version of Linux kernel 2.6.39 , which can run in Iphone
$ ls –l
Building kernel procedure is same. First change the configuration.
Change the device building to Iphone
System type > Arm system type> select Apple Iphone
System type Apple Iphone platform type > Select device {Iphone 2G}
Save and exit.
Before building the kernel let’s put some debug message in kernel boot process so we can see if our kernel is running in the device.
Kernel hacking:(http://www.linuxchix.org/content/courses/kernel_hacking/lesson5)
Find ”static noinline int init_post(void)” function after ”numa_default_policy();” line, add couple lines of printk() .(more printk() makes it easy to be seen on small Iphone screen)
printk("* MY kernel 1! *\n");
printk("* YOUR kernel 1! *\n");
printk("* I kernel ! *\n");
printk("* MY kernel 1! *\n");
printk("* YOUR kernel 1! *\n");
printk("* I kernel ! *\n");
We’ll use the NDK tool chain to built kernel
<android-ndk-location>/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-
To define which tool chain will be used to kernel build, CROSS_COMPILE is needed to be set.
Add location to $PATH and set CROSS_COMPILE with relative path
$export CROSS_COMPILE=arm-linux-androideabi-
Or set CROSS_COMPILE with absolute path.
and build the kernel
(-j = num of compile processes, 2 per core)
Building with out setting CROSS_COMPILE variable
kernel file ”zImage” should be in
7.0 Building Bootloader
Building bootloader: (http://www.idroidproject.org/wiki/Building_OpeniBoot)
I used prebuilt packet for this project.
8.0 Porting Android to Iphone
Kernel and Android OS are built, now we need to transfer these files to device(Iphone) and run it.
To transfer files to Iphone sftp connection is required (look at: section 3.0 Preparing Device(Iphone) for Porting) transfer all files to Iphone /var directtory
$ dd if=/dev/zero of= cache.img bs=1M count=50
$ mkfs -t ext2 cache.img
- Reboot the device (Iphone)
In terminal typeMore information on installing Openiboot: http://www.idroidproject.org/wiki/Installing_OpeniBoot
9.0 Trobleshooting
Problems that I have had engaged during this project and their solutions.
Most of them are related to Android OS and Linux kernel building procedure
9.1 Kernel Building Issues
...
CC kernel/cpuset.o
kernel/cpuset.c: In function 'cpuset_can_attach':
kernel/cpuset.c:1333: error: 'task' undeclared (first use in this function)
kernel/cpuset.c:1333: error: (Each undeclared identifier is reported only once
kernel/cpuset.c:1333: error: for each function it appears in.)
make[1]: * [kernel/cpuset.o] Error 1
make: * [kernel] Error 2
Solution:
Genereal Setup>Control Group support>Cpuset Support à Disable
...
CC drivers/video/console/vgacon.o
drivers/video/console/vgacon.c: In function 'vgacon_startup':
drivers/video/console/vgacon.c:508: error: 'PCIMEM_BASE' undeclared (first use in this function)
drivers/video/console/vgacon.c:508: error: (Each undeclared identifier is reported only once
drivers/video/console/vgacon.c:508: error: for each function it appears in.)
drivers/video/console/vgacon.c: In function 'vgacon_do_font_op':
drivers/video/console/vgacon.c:1068: error: 'PCIMEM_BASE' undeclared (first use in this function)
make[3]: * [drivers/video/console/vgacon.o] Error 1
make[2]: * [drivers/video/console] Error 2
make[1]: * [drivers/video] Error 2
make: * [drivers] Error 2
Solution:
Device Drivers>Graphics support>Console display driver support>VGA text Console àDisable
...
drivers/video/iphone-fb.c: In function 'iphonefb_suspend':
drivers/video/iphone-fb.c:385: error: implicit declaration of function 'platform_device_get_drvdata'
edit drivers/video/iphone-fb.c:
add #include <linux/device.h>
Solution:
Power management > warelock à Early Suspend
/root/Downloads/kernel_common/usr/include/linux/if_pppox.h:24: included file 'linux/if_pppolac.h' is not exported
/root/Downloads/kernel_common/usr/include/linux/if_pppox.h:25: included file 'linux/if_pppopns.h' is not exported
Solution: Disable kernel header check.
Kernel hacking ->Run 'make headers_check' when building vmlinux à disable
suspend.c:(.init.text+0x694): undefined reference to `i2c_add_numbered_adapter'
suspend.c:(.init.text+0x6b0): undefined reference to `i2c_add_numbered_adapter'
make: *** [.tmp_vmlinux1] Error 1
Solution: Disable kernel header check.
Device drivers > I2C support à enabled
9.2 Android Issues
I’d like to build Gingerbread at first but when I tried to build I received the error below
build/core/main.mk:76:
build/core/main.mk:77: You are attempting to build on a 32-bit system.
build/core/main.mk:78: Only 64-bit build environments are supported beyond froyo/2.2.
build/core/main.mk:79:
build/core/main.mk:80: *** stop. Stop.
I had to download FROYO (Android 2.2)
Get https://android.googlesource.com/tools/repo
fatal: https://android.googlesource.com/tools/repo/info/refs download
error - The requested URL returned error: 403
Solution: git needs to be updated to 1.6.6 or newer.
Checking build tools versions...
You are attempting to build with the incorrect version of java.
Your version is: java version "1.6.0_0".
The correct version is: 1.5.
In my system (fedora 12) default java version is 1.6. I couldn’t build Gingerbread because it requires 64 bit OS. I moved to Froyo and it requires java version 1.5
Solution: downgrade java to version 1.5
Locate where java files are.
/root/rpmbuild/BUILD/jdk1.5.0_22/bin/javac
/usr/bin/javac
/usr/lib/jvm/java-1.5.0-sun-1.5.0.22/bin/javac
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/bin/javac
/usr/share/doc/xerces-j2-2.7.1/tools/bin/xjavac.jar
Change location: we need to add location beginning of the PATH other wise system still will keep using current one.
Check which java is in use
java version "1.5.0_22"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_22-b03)
Java HotSpot(TM) Server VM (build 1.5.0_22-b03, mixed mode)
sh: gperf: command not found
calling gperf failed: 32512 at ./makeprop.pl line 96.
Solution: install gperf tool
fatal: Unable to look up github.com (port 9418) (Temporary failure in name resolution)
Problem was network. I was trying to download in my office but office firewall didn’t let me download.
Downloading Idroid problems
warning: no common commits
remote: Counting objects: 470, done.
remote: Compressing objects: 100% (206/206), done.
remote: Total 470 (delta 182), reused 433 (delta 149)
Receiving objects: 100% (470/470), 98.98 KiB, done.
Resolving deltas: 100% (182/182), done.
From git:github.com/iDroid-Project/platform_manifest
* [new branch] froyo-iphone -> origin/froyo-iphone
+ 1b6c432...8c13d26 gingerbread -> origin/gingerbread (forced update)
+ 1e41b43...1e65323 master -> origin/master (forced update)
From git:github.com/iDroid-Project/platform_manifest
* [new tag] android-1.0 -> android-1.0
.repo/manifests/: manifest switched android-2.2.2_r1...gingerbread
.repo/manifests/: discarding 19 commits removed from upstream
fatal: manifest 'default.xml' not available
fatal: remote korg not defined in /root/.repo/manifests/default.xml//
First I didn’t understand the problem. Removed target folder and recheck out
fatal: manifest 'default.xml' not available
fatal: remote korg not defined in /root/.repo/manifests/default.xml
Problem was clear. Definition was missing in Android manifesto.
Checked /root/.repo/manifests/default.xml
<remote name="Google"
fetch="https://android.googlesource.com/"
review="review.source.android.com" />
<remote name="iDroid"
fetch="git:github.com/iDroid-Project/" />
<default revision="gingerbread"
remote="korg" />
<project path="build" name="platform_build" remote="iDroid">
...
“Remote=korg” was not defined in manifesto.
Changed
<remote name="iDroid" fetch="git:github.com/iDroid-Project/" />
<default revision="gingerbread" remote="korg" />
to
<remote name="iDroid" fetch="git:github.com/iDroid-Project/" />
<default revision="gingerbread" remote="iDroid" />
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=2.3.7
TARGET_PRODUCT=iPhone2G
TARGET_BUILD_VARIANT=eng
TARGET_SIMULATOR=false
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=GINGERBREAD
============================================
build/core/base_rules.mk:78: * Module name: test_guard_variables
build/core/base_rules.mk:79: * Makefile location: android-ndk-r7/tests/device/test-gabi++-guard/jni
build/core/base_rules.mk:80: *
build/core/base_rules.mk:81: * Each module must use a LOCAL_MODULE_TAGS in its
build/core/base_rules.mk:82: * Android.mk. Possible tags declared by a module:
build/core/base_rules.mk:83: *
build/core/base_rules.mk:84: * optional, debug, eng, tests, samples
build/core/base_rules.mk:85: *
build/core/base_rules.mk:86: * If the module is expected to be in all builds
build/core/base_rules.mk:87: * of a product, then it should use the
build/core/base_rules.mk:88: * "optional" tag:
build/core/base_rules.mk:89: *
build/core/base_rules.mk:90: * Add "LOCAL_MODULE_TAGS := optional" in the
build/core/base_rules.mk:91: * Android.mk for the affected module, and add
build/core/base_rules.mk:92: * the LOCAL_MODULE value for that component
build/core/base_rules.mk:93: * into the PRODUCT_PACKAGES section of product
build/core/base_rules.mk:94: * makefile(s) where it's necessary, if
build/core/base_rules.mk:95: * appropriate.
build/core/base_rules.mk:96: *
build/core/base_rules.mk:97: * If the component should be in EVERY build of ALL
build/core/base_rules.mk:98: * products, then add its LOCAL_MODULE value to the
build/core/base_rules.mk:99: * PRODUCT_PACKAGES section of
build/core/base_rules.mk:100: * build/target/product/core.mk
build/core/base_rules.mk:101: *
build/core/base_rules.mk:102: * user tag detected on new module - user tags are only supported on legacy modules. Stop.
[root@localhost ~]#
* Makefile location: android-ndk-r7/tests/device/multi-static-instances/jni
build/core/base_rules.mk:78: * Module name: test_cpufeatures
build/core/base_rules.mk:79: * Makefile location: android-ndk-r7/tests/device/test-cpufeatures/jni
build/core/base_rules.mk:78: * Module name: hello-jni
build/core/base_rules.mk:79: * Makefile location: android-ndk-r7/samples/hello-jni/jni
Solutions: Add "LOCAL_MODULE_TAGS := optional" in the corresponding Android.mk file(s) after each include $(CLEAR_VARS)
9.3 Other Issues
Solution: yum install didn't work but I found packet online and install it
http://rpmfind.net/linux/rpm2html/search.php?query=libreadline.so.5
Unfortunately I doesn’t work stable.
10.0 Resources
Idroid Project:
http://www.idroidproject.org
OpenIboot:
http://www.idroidproject.org/wiki/OpeniBoot
Android project main:
http://www.android.com
Android SDK:
http://developer.android.com
Android SDK Install:
http://developer.android.com/sdk/installing.html
Android NDK :
http://developer.android.com/sdk/ndk/overview.html
Android Source Code:
http://source.android.com
Embedded Linux Wiki:
http://elinux.org/Android_Build_System#Actually_building_the_system
Repo more information:
http://source.android.com/source/version-control.html
Kernel Hacking:
http://www.linuxchix.org/content/courses/kernel_hacking/lesson5
Buliding Java RPM:
http://iomem.com/archives/1-Building-Java-RPMS-for-Redhat-Enterprise-Linux.html
Iphone Jail break :
http://www.iclarified.com/tutorials/iphone/index.php
Iphone SSH Connection:
http://www.iclarified.com/entry/index.php?enid=5637